package cn.cs.service;

import cn.cs.mapper.AfterOrderMapper;
import cn.cs.mapper.CommonFailuresMapper;
import cn.cs.pojo.AfterOrder;
import cn.cs.pojo.CommonFailures;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

@RestController
public class CommonFailuresService {

    @Resource
    private CommonFailuresMapper commonFailuresMapper;

    @RequestMapping(value = "/getCommonFailuresById", method = RequestMethod.POST)
    public CommonFailures getCommonFailuresById(@RequestParam("id") String id) throws Exception{
        return commonFailuresMapper.getCommonFailuresById(id);
    }

    @RequestMapping(value = "/getCommonFailuresListByMap", method = RequestMethod.POST)
    public List<CommonFailures> getCommonFailuresListByMap(@RequestBody Map<String, Object> param) throws Exception{
        return commonFailuresMapper.getCommonFailuresListByMap(param);
    }

    @RequestMapping(value = "/getCommonFailuresCountByMap", method = RequestMethod.POST)
    public Integer getCommonFailuresCountByMap(@RequestBody Map<String, Object> param) throws Exception{
        return commonFailuresMapper.getCommonFailuresCountByMap(param);
    }

    @RequestMapping(value = "/addCommonFailures", method = RequestMethod.POST)
    public Integer addCommonFailures(@RequestBody CommonFailures commonFailures) throws Exception{
        return commonFailuresMapper.insertCommonFailures(commonFailures);
    }

    @RequestMapping(value = "/modifyCommonFailures", method = RequestMethod.POST)
    public Integer modifyCommonFailures(@RequestBody CommonFailures commonFailures) throws Exception{
        return commonFailuresMapper.updateCommonFailures(commonFailures);
    }

    @RequestMapping(value = "/deleteCommonFailuresById", method = RequestMethod.POST)
    public Integer deleteCommonFailuresById(@RequestParam("id") String id) throws Exception{
        return commonFailuresMapper.deleteCommonFailuresById(id);
    }

}
